PATHMac OS 8 and 9 Developer Documentation > Human Interface Toolbox > Appearance Manager >

Programming With the Appearance Manager


SetThemePen

Applies a theme-compliant color or pattern to the foreground of the current port.

pascal OSStatus SetThemePen (
                     ThemeBrush inBrush,
                     SInt16 inDepth,
                     Boolean inIsColorDevice);
inBrush
A value of type ThemeBrush . Pass a constant specifying the theme brush type to which to set the pen; see Theme Brush Constants for descriptions of possible values.
inDepth
A signed 16-bit integer. Pass a value specifying the bit depth (in bits per pixel) of the current graphics port.
inIsColorDevice
A value of type Boolean . Pass true to indicate that you are drawing on a color device. Pass false for a monochrome device.
function result
A result code. The result code appearanceBadBrushIndexErr indicates that the brush constant passed in was not valid. For other possible result codes, see Result Codes .
DISCUSSION

Your application should call the SetThemePen function each time you wish to draw an element in a specified brush constant.

Because the constant in the inBrush parameter can represent a color or pattern, depending on the current theme, your application must save and restore the current drawing state of the graphics port around calls to SetThemePen . Under Appearance Manager 1.1 and later, you can use the functions GetThemeDrawingState and SetThemeDrawingState to do this. Prior to Appearance Manager 1.1, you must save and restore the pnPixPat and bkPixPat fields of your graphics port when saving the text and background colors. Because patterns in the pnPixPat field override the foreground color of the window, call the QuickDraw function PenPat to set your foreground pattern to a normal white pattern. This ensures that you can use RGBForeColor to set your foreground color to white, call the QuickDraw function PaintRect , and get the expected results.

VERSION NOTES

Available with Appearance Manager 1.0 and later.


© 1999 Apple Computer, Inc. – (Last Updated 29 April 99)